package com.xuxin.baby.activity;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.xuxin.baby.R;
import com.xuxin.baby.base.BaseActivity;
import com.xuxin.baby.base.BasePagerAdapter;
import com.xuxin.baby.fragment.TicketFragment;
import com.xuxin.smartTabLayout.SlidingTabLayout;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by xu_xin
 * Created on 2020/11/19 0019
 * 学习券
 */
public class UserTicketActivity extends BaseActivity {
    @BindView(R.id.title_left)
    ImageView title_left;
    @BindView(R.id.title_right)
    ImageView title_right;
    @BindView(R.id.title_name)
    TextView title_name;
    @BindView(R.id.sliding_stl)
    SlidingTabLayout sliding_stl;
    @BindView(R.id.sliding_pager)
    ViewPager sliding_pager;
    private final ArrayList<Fragment> mFragments = new ArrayList<>();
    private final String[] mTitles = {"全部", "即将过期", "失效"};

    @Override
    public void setContentView() {
        setContentView(R.layout.activity_ticket);
    }

    @Override
    public void initView() {
        title_name.setText("学习券");
        mFragments.add(TicketFragment.newInstance(0));
        mFragments.add(TicketFragment.newInstance(1));
        mFragments.add(TicketFragment.newInstance(2));
        BasePagerAdapter myAdapter = new BasePagerAdapter(getSupportFragmentManager(), mFragments, mTitles);
        sliding_pager.setAdapter(myAdapter);
        sliding_stl.setViewPager(sliding_pager);
    }

    @Override
    public void initData() {
    }

    @Override
    public void onComplete() {
    }

    @Override
    @OnClick({R.id.title_left})
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.title_left) {
            finish();
        }
    }
}